package com.pf.controller;

import com.pf.dto.BaseResult;
import com.pf.dto.request.LogListReq;
import com.pf.dto.response.LogListResp;
import com.pf.service.LogInfoService;
import com.pf.utils.BaseResultUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author PanFei
 * @version 1.0.0
 * @createTime 2021/8/14
 */
@RestController
@RequestMapping("/job/log")
public class JobLogController {

    @Autowired
    private LogInfoService logInfoService;

    /**
     * 查询日志列表信息
     *
     * @param logReq
     * @return
     */
    @GetMapping("/list")
    public BaseResult<List<LogListResp>> getLogInfoList(LogListReq logReq) {
        return BaseResultUtils.success(logInfoService.getLogInfoList(logReq));
    }

    /**
     * 查看日志详情
     *
     * @param logId
     * @return
     */
    @GetMapping("/details")
    public BaseResult<LogListResp> getLogInfo(@RequestParam("logId") String logId) {
        return BaseResultUtils.success(logInfoService.getLogInfo(logId));
    }

}
